package com.edu.hre.struts.form.dashboard;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.struts.action.ActionForm;

import com.edu.hre.common.utils.CommonUtils;
import com.edu.hre.db.pojo.HreLeaveType;

public class DashLeaveForm extends ActionForm implements Serializable {

	/**
	 * 
	 */
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
	private static final long serialVersionUID = -4383681338905055410L;
	
	private Date fromDate = null;
	private Date toDate = null;
	private List<HreLeaveType> listLeaveType = new ArrayList<HreLeaveType>();
	private int leaveTypeId;
	
	public DashLeaveForm() {
		// TODO Auto-generated constructor stub
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	public List<HreLeaveType> getListLeaveType() {
		return listLeaveType;
	}

	public void setListLeaveType(List<HreLeaveType> listLeaveType) {
		this.listLeaveType = listLeaveType;
	}

	public int getLeaveTypeId() {
		return leaveTypeId;
	}

	public void setLeaveTypeId(int leaveTypeId) {
		this.leaveTypeId = leaveTypeId;
	}
	
	public String getToDateStr() {
		if(this.toDate == null){
			return "";
		}
		return dateFormat.format(this.toDate);
	}

	public void setToDateStr(String toDate) {
		try {
			this.toDate = dateFormat.parse(toDate);
		} catch (Exception e) { 
			CommonUtils.println(e.getMessage());
		}
	}

	public String getFromDateStr() {
		if(this.fromDate == null){
			return "";
		}
		return dateFormat.format(this.fromDate);
	}

	public void setFromDateStr(String fromDate) {
		try {
			this.fromDate = dateFormat.parse(fromDate);
		} catch (Exception e) { 
			CommonUtils.println(e.getMessage());
		}
	}
	
}
